package models

import (
	"sale-admin/internal/app/web/schema"
)

// MaGoodsActivity [...]
type MaGoodsActivityDetail struct {
	ID                         string                         `gorm:"autoIncrement:true;primaryKey;column:id;type:bigint;not null"  json:"id" json_old:"ID"`
	ActivityID                 string                         `gorm:"column:activity_id;type:bigint;not null;comment:某台机器的活动ID"  json:"activity_id" json_old:"ActivityID"`
	SalesID                    string                         `gorm:"column:sales_id;type:varchar(128);not null;comment:机器识别码"  json:"sales_id" json_old:"SalesID"`
	Type                       string                         `gorm:"column:type;type:varchar(128);not null;comment:活动类型1折扣2换购价"  json:"type" json_old:"Type"`
	GoodsID                    string                         `gorm:"column:goods_id;type:bigint;not null;comment:触发的的商品ID"  json:"goods_id" json_old:"GoodsID"`
	MultiDiscountGoods         string                         `gorm:"column:multi_discount_goods;type:text;not null;comment:优惠商品商品ID及折扣详情，存入JSON字符串格式"  json:"-" json_old:"MultiDiscountGoods"`
	MultiDiscountGoodsFormated []schema.MultiDiscountGoodsNew `gorm:"-" json:"multi_discount_goods"`
	AddTimeFormated            string                         `gorm:"-"   json:"add_time"`
	CreatedAt                  int64                          `gorm:"index:created_at;column:created_at;autoCreateTime;type:int;size:64;comment:创建时间" json:"created_at"`
}

// TableName get sql table name.获取数据库表名
func (m MaGoodsActivityDetail) TableName() string {
	return "ma_goods_activity_detail"
}

// 模式自动注册
func init() {
	Models = append(Models, &MaGoodsActivityDetail{})
}
